<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>商家搜索</title>
<meta name="content-type" content="text/html; charset=UTF-8">
<jsp:include page="/pub.jsp"></jsp:include>
<script type="text/javascript">
var aotemaiShopDataGrid;
$(function() {
	aotemaiShopDataGrid = $('#aotemaiShop_datagrid').datagrid({
		url : '${pageContext.request.contextPath}/aotemaiShop/list',
		fit : true,
		fitColumns : true,
		border : false,
		pagination : true,
		idField : 'id',
		pagePosition : 'both',
		checkOnSelect:true,
		selectOnCheck:true,
		columns : [ [ {
			field : 'id',
			title : '编号',
			width : 100,
			checkbox : true
		}, {
			field : 'no',
			title : '编号',
			width : 100
		}, {
			field : 'name',
			title : '商家名',
			width : 100
		}, {
			field : 'address',
			title : '地址',
			width : 100
		}, {
			field : 'email',
			title : '邮箱',
			width : 100
		}, {
			field : 'mobile',
			title : '手机号',
			width : 100
		}, {
			field : 'remark',
			title : '备注',
			width : 100
		}] ],
		onRowContextMenu:function(e, rowIndex, rowData){
			e.preventDefault();
			$(this).datagrid('clearSelections');
			$(this).datagrid('clearChecked');
			$(this).datagrid('selectRow',rowIndex);
			$('#aotemaiShop_menu').menu('show', {
				left : e.pageX,
				top : e.pageY
			});
		},toolbar:'#tb'
	});
	
});

/* ------------------------------拓展功能 --------------------- */

var shopSearch_submitForm = function(dialog, p, shopId, shopName) {
	var rows = aotemaiShopDataGrid.datagrid('getChecked');
	if(rows.length == 1){
		shopId.val(rows[0].id);
		shopName.textbox('setValue',rows[0].name);
		dialog.dialog('destroy');
	}else{
		parent.$.messager.alert('提示','请选择一条记录');
	}
};

function aotemaiShop_searchFun() {
	$('#aotemaiShop_datagrid').datagrid('load', serializeObject($('#aotemaiShop_searchForm')));
}
function aotemaiShop_clearFun() {
	$('#aotemaiShop_searchForm input').val('');
}
</script>
</head>

<body>
<div class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false,title:'商家列表'" style="overflow: hidden;">
		<table id="aotemaiShop_datagrid"></table>
	</div>
</div>

<div id="tb" style="padding:2px 5px;">
	<form id="aotemaiShop_searchForm">
		商家名：<input class="easyui-textbox" name="name"/>
		编号：<input class="easyui-textbox" name="no"/>
        <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-search" onclick="aotemaiShop_searchFun();">查询</a>
        <a href="javascript:void(0);" class="easyui-linkbutton" iconCls="icon-clear" onclick="aotemaiShop_clearFun();">清空</a>
	</form>
</div>

</body>
</html>